
import { _decorator, AnimationClip, Component, Animation, SpriteFrame } from 'cc';
// import { FSM_PARAMS_TYPE_ENUM, PARAMS_NAME_ENUM } from '../../Enum';
import State from './State';
import { FSM_PARAMS_TYPE_ENUM } from '../Enum';
import { StateMachine } from './StateMachine';
// import State from '../../Base/State';
const { ccclass, property } = _decorator;

/**
 * Predefined variables
 * Name = PlayerState
 * DateTime = Wed Jun 28 2023 09:28:04 GMT+0800 (中国标准时间)
 * Author = zshzshzsh15
 * FileBasename = PlayerState.ts
 * FileBasenameNoExtension = PlayerState
 * URL = db://assets/Script/Player/PlayerState.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 */


export abstract class SubStateMachine{

    constructor(public fsm:StateMachine){}
    
    //子状态机用父状态机列表

//需要一个参数列表，和一个状态机列表

//当前状态
    private _currentState:State =null






    stateMachines:Map<string,State> = new Map()  //状态机列表




    // resetTrigger(){
    //     for(const [_,value] of this.params){
    //         if(value.type === FSM_PARAMS_TYPE_ENUM.TRIGGER){
    //             value.value =false
    //         }
    //     }
    // }
    get currentState(){
        return this._currentState

    }

    set currentState(newState:State){
        this._currentState=newState
        this._currentState.run()
    }


    //判断当前状态
    abstract  run()
    
}

/**
 * [1] Class member could be defined like this.
 * [2] Use `property` decorator if your want the member to be serializable.
 * [3] Your initialization goes here.
 * [4] Your update function goes here.
 *
 * Learn more about scripting: https://docs.cocos.com/creator/3.4/manual/zh/scripting/
 * Learn more about CCClass: https://docs.cocos.com/creator/3.4/manual/zh/scripting/decorator.html
 * Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.4/manual/zh/scripting/life-cycle-callbacks.html
 */
